package org.jwos.plugin.file.domain;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.activation.DataSource;

public class RepositoryFileDataSource implements DataSource {
	
	private String name;
	
	private String contentType;
	
	private InputStream inputStream;
	
	public RepositoryFileDataSource() {		
	}
	
	public RepositoryFileDataSource(InputStream inputStream,String name,String contentType) {
		this.inputStream = inputStream;
		this.name = name;
		this.contentType = contentType;
	}

	public String getContentType() {
		if (contentType == null)
			this.contentType = "application/octet-stream";
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public InputStream getInputStream() throws IOException {
		return inputStream;
	}

	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public OutputStream getOutputStream() throws IOException {
		throw new FileNotFoundException();
	}
}
